<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="/Public/Admin/css/pintuer.css">
    <link rel="stylesheet" href="/Public/Admin/css/admin.css">

</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong><span class="icon-key"></span> 修改会员密码</strong></div>
    <div class="body-content">
        <form method="post" class="form-x" id="forma" name="forma" action="<?php echo U('Password/save');?>">
            <input type="hidden" name="id" value="<?php echo ($list["id"]); ?>" />
            <div class="form-group">
                <div class="label">
                    <label for="sitename">管理员帐号：</label>
                </div>
                <div class="field">
                    <label style="line-height:33px;">
                        <?php echo ($list["name"]); ?>
                    </label>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label for="sitename">原始密码：</label>
                </div>
                <div class="field">
                    <input type="password" class="input w50" id="mpass" name="password" size="50" placeholder="请输入原始密码" />
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label for="sitename">新密码：</label>
                </div>
                <div class="field">
                    <input type="password" class="input w50" name="newpassword" size="50" placeholder="请输入新密码" />
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label for="sitename">确认新密码：</label>
                </div>
                <div class="field">
                    <input type="password" class="input w50" name="renewpass" size="50" placeholder="请再次输入新密码" />
                </div>
            </div>

            <div class="form-group">
                <div class="label">
                    <label></label>
                </div>
                <div class="field">
                    <button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
                </div>
            </div>
        </form>
    </div>
</div>
<script src="/Public/Admin/js/jquery.min.js"></script>
<script src="/Public/Admin/js/pintuer.js"></script>
<script src="/Public/Admin/js/bootstrap.min.js"></script>
<script src="/Public/Admin/js/plugins/layer/layer.min.js"></script>
<script src="/Public/Admin/js/plugins/validate/jquery.validate.min.js"></script>
<script src="/Public/Admin/js/plugins/validate/messages_zh.min.js"></script>
<script src="/Public/Admin/js/common.js"></script>
<script>
    $(function(){
        $("#forma").validate({
            rules:{
                password:"required",
                newpassword:{
                    required:true,
                    minlength:5,
                    maxlength:15
                }
            },
            messages:{
                password:'旧密码不能为空!',
                newpassword:{
                    required:'新密码不能为空！',
                    minlength:'新密码长度不符合规则！',
                    maxlength:'新密码长度不符合规则！'
                }
            },
            submitHandler: function(form){
                //通过ajax将整个form表单提交
                var forma = new  FormData(document.getElementById('forma'));
                $.ajax({
                    url:$(form).attr('action'),
                    type:'post',
                    dataType:'json',
                    data:forma,
                    cache: false,
                    processData: false,
                    contentType: false,
                    success:function(data){
                        if(data.status < 1){
                            common.error(data.msg);
                        }else{
                            common.success(data.msg,"<?php echo U('password/index');?>");
                        }
                    }
                });
            }
        });
    });
</script>
</body>

</html>